var requestHost = "http://61.153.100.47:8089/cdt/";
//var requestHost = "http://61.153.100.47:8088/cdt/";


//var access_token = ""
var lastParameter = "&platform=WXGZH&version=3.5"
var userMoney = 0.0;//用户金额
var presentMoney = 0.0;//用户赠送金额
var preMoney = 0.0;//用户押金
var userPhone = undefined


//写cookies
function setCookie(name, value) {
    var Days = 30;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString()+";path=/;";
}

//读取cookies
function getCookie(name) {
    var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");

    if (arr = document.cookie.match(reg)) return unescape(arr[2]);
    else return null;
}

//弹窗隐藏方法
//$.popUpIsHide = function(){
//    $('.popup').hide();
//    $('.popup-bg').hide();
//}
//弹窗方法
$.popUpMessage = function(type,message1,message2,button1,button1Id,button2,button2Id,isClick){
    $('.popup').show();
    $('.popup-bg').show();
    var messageImgUrl = "";
    //正确提示图标
    if(type == 1){
        messageImgUrl = "images/right-icon.png";
    }
    //提醒提示图标
    else if(type == 2){
        messageImgUrl = "images/prompt-icon.png";
    }
    //读取中图标
    else if(type == 3){
        messageImgUrl = "images/loding-icon.png";
    }
    //错误图标
    else if(type == 4){
        messageImgUrl = "images/wrong-icon.png";
    }
    //购买安卓数据线图标
    else if(type == 5){
        messageImgUrl = "images/android-line-icon.png";
    }
    //购买苹果数据线图标
    else if(type == 6){
        messageImgUrl = "images/iphone-line-icon.png";
    }

    if(type == 3){
        $('.popup-title2').show();
        $('.popup-title').hide();
        $('.popup-title2 .font1').text(message1);

        $('.popup-title2 img').attr('src',messageImgUrl);
    }
    else {
        $('.popup-title2').hide();
        $('.popup-title').show();
        $('.popup-title-font .font1').text(message1);
        $('.popup-title-font .font2').text(message2);

        $('.popup-title img').attr('src', messageImgUrl);
    }

    if(button2 == null){
        $('.two-button').hide();
        $('.one-button .one-button-1').text(button1);
        $('.one-button .one-button-1').unbind();
        $('.one-button .one-button-1').attr('id',button1Id);
        $('.one-button').show();
    }
    else{
        $('.one-button').hide();
        $('.two-button .two-button-1').text(button1);
        $('.two-button .two-button-1').unbind();
        $('.two-button .two-button-1').attr('id',button1Id);
        $('.two-button .two-button-2').text(button2);
        $('.two-button .two-button-2').unbind();
        $('.two-button .two-button-2').attr('id',button2Id);
        $('.two-button').show();
    }

    if(isClick == 0){
        setTimeout('$.popUpIsHide()',3000);
    }
    else{
        if(button1Id == null){
            if(button2 != null){
                $('.two-button .two-button-1').click(function(){
                    $.popUpIsHide()
                })
            }
            else{
                $('.one-button .one-button-1').click(function(){
                    $.popUpIsHide()
                })
            }
        }
    }

}
